package com.zzyl.controller.customer;


import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/customer/orders/project")
@Api(tags = "服务项结口")
public class CustomerProjectController {


    @Autowired
    private NursingProjectService nursingProjectService;

    @ApiOperation("分页查询护理项目接口")
    @GetMapping("/page")
    public ResponseResult<PageResponse<NursingProjectVo>> searchNursingProject(
            @ApiParam(value = "护理项目名称")
            @RequestParam(required = false) String name,
            @ApiParam(value = "护理项目状态")
            @RequestParam(required = false) Integer status,
            @ApiParam(value = "页码（默认为1）")
            @RequestParam(required = false, defaultValue = "1") Integer pageNum,
            @ApiParam(value = "每页大小（默认为10）")
            @RequestParam(required = false, defaultValue = "10") Integer pageSize) {
        return ResponseResult.success(nursingProjectService.getByPage(name, status, pageNum, pageSize));
    }


    @ApiModelProperty("查询护理项目详情接口")
    @GetMapping("/{id}")
    public ResponseResult<NursingProjectVo> getNursingProjectById(@ApiParam(value = "护理项目id") @PathVariable("id") Long id) {
        return ResponseResult.success(nursingProjectService.getById(id));
    }
}
